package com.demo.association.onetomany;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name="EMPLOYEE2")
public class EmployeeDTO {


	private int id;
	private String name;
	private double salary;
  
	private DepartmentDTO department;
	
	public EmployeeDTO(String empName,double empSalary) {
		this.name=empName;
		this.salary=empSalary;
	}
    public EmployeeDTO() {
		// TODO Auto-generated constructor stub
	}
	
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	@Column(name="EMP_ID")
	public int getId() {
		return id;
	}
	@Column(name="EMP_NAME")
	public String getName() {
		return name;
	}
	@Column(name="EMP_SALARY")
	public double getSalary() {
		return salary;
	}

	@ManyToOne()
	@JoinColumn(name="DEPART_ID")
	public DepartmentDTO getDepartment() {
		return department;
	}
	
	
	
	public void setDepartment(DepartmentDTO department) {
		this.department = department;
	}
	
	
	public void setId(int id) {
		this.id = id;
	}
	public void setName(String name) {
		this.name = name;
	}
	public void setSalary(double salary) {
		this.salary = salary;
	}

	@Override
	public String toString() {
		return "EmployeeDTO [id=" + id + ", name=" + name + ", salary="
				+ salary + "]";
	}
}
